package com.yeung.spel;

import java.util.HashMap;
import java.util.Map;

/**
 * 实例工厂方法:实例化工厂后调用成员方法返回Bean的实列
 */
public class InstanceCarFactory {
    private  Map<String, Car> cars = null;

    public InstanceCarFactory() {
        cars=new HashMap<>();
        cars.put("audi", new Car(1, "audi", 393994, 322, null));
        cars.put("ford", new Car(31, "ford", 39313994, 333, null));
    }

    //静态工厂方法创建 对象
    public Car getCar(String name) {
        return cars.get(name);
    }
}
